home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / System / ReqAttack / ReqReplacers / RODreamSound.e < prev    next >
Encoding:
Text File  |  2001-02-23  |  2.3 KB  |  55 lines

  1. /* Example sound player. It reads the command from ENV:RODreamSound and
  2.    adds the sample to play at the end of the string, so the variable in
  3.    ENV: sould be for example 'run >nil: c:xplay nfl sounds=' (without
  4.    quotas of course). This isn't a proper way to play samples with ReqAttack,
  5.    but I understand that RASoundDeamon which uses datatypes isn't very
  6.    good either.
  7.  
  8.    Program suggested by BKJ (Vulture@freemail.gr).
  9.  
  10.    IMPORTANT: To protect ReqOFF againts going into infinitive loop (when your
  11.    requester replacer calls EasyRequestArgs() with same TITLE and/or TEXT
  12.    as the original requester) you should add a single space as a first byte
  13.    of title string, or simply change it to other title which will not qualify
  14.    to be patched by your program again and again and again...
  15.  
  16.    IMPORTANT: the easystruct you receive as 0x12345678 (the last argument)
  17.    contains the bodytext preprocessed by RawDoFmt. If you wan't to filter
  18.    the requester you should exit with 127 (ENDPROC REQATTACK_DISPLAYREQ/
  19.    RETURN REQATTACK_DISPLAYREQ). This will cause the requester to open as
  20.    a normal requester (not ReqOFF'ed).
  21. */
  22.  
  23. MODULE 'dos/dos','intuition/intuition','jaca/replacer'
  24.  
  25. DEF pos
  26. DEF fh,file[1501]:STRING,fib[260]:ARRAY OF CHAR,fibl:PTR TO fileinfoblock
  27. DEF file2[1001]:STRING,re:PTR TO replacerdata
  28.  
  29. PROC main()
  30. IF fh:=Open('ENV:RODreamSound.prefs',MODE_OLDFILE)
  31.   ExamineFH(fh,fib);fibl:=fib         ->  read the command to execute...
  32.   Read(fh,file,fibl.size)
  33.   file[fibl.size+1]:=NIL
  34.   Close(fh)
  35.  
  36.   IF StrCmp(arg,'"',1)                ->  the 1st arg is sample name
  37.     pos:=InStr(arg,'"',1)             ->  which has to be specified in
  38.     StrCopy(file2,arg,pos)            ->  RAPrefsMUI
  39.   ELSE
  40.     pos:=InStr(arg,' ',1)
  41.     StrCopy(file2,arg,pos)            ->  now the file variable contains
  42.   ENDIF                               ->  the file name
  43.  
  44.   StringF(file,'\s \s',file,file2)
  45. ENDIF
  46.  
  47.   pos:=InStr(arg,'0x',0)              ->  replace all 0x with ' $'
  48.   arg[pos]:=$20;arg[pos+1]:=$24       ->  Val() needs hexadecimal numbers...
  49.   re:=Val(arg+pos,0)                  ->  (get the value)
  50.                                       ->  ...to be preceded by '$'
  51.  
  52.                                       ->  run the command...
  53.     SystemTagList(file,NIL)
  54. ENDPROC REQATTACK_DISPLAYREQ ->let ReqAttack open the original requester...
  55.